<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateArticlesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('articles', function (Blueprint $table) {
            $table->increments('id')->comment('文章id');
            $table->string('title')->comment('文章的标题');
            $table->string('description')->comment('文章的描述');
            $table->text('content')->comment('文章的内容');
            $table->string('image')->nullable()->comment('文章的图片');
            $table->integer('classify_id')->unsigned()->comment('文章的分类id');
            $table->integer('browse_number')->default(0)->comment('文章的浏览量');
            $table->integer('like_number')->default(0)->comment('文章的点赞量');
            $table->boolean('is_recommend')->default(false)->comment('文章是否设置为推荐');
            $table->boolean('is_top')->default(false)->comment('文章是否设置为置顶');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('articles');
    }
}
